#!/usr/bin/env python3
exit_key = ["exit", "q", "Q"]
filename = "test.txt"

with open(filename, "w") as file:
    while True:
        prog_language = input("what's your favor programe language? (Type 'exit' or 'q' to quit) \n")
        if  prog_language in exit_key:
            break
        prog_language += ":"

        reason = input("why ? (Type 'exit' or 'q' to quit) \n")
        if  reason in exit_key:
            break
        prog_language += reason
        prog_language += "\n"
        
        if prog_language:
            file.write(prog_language) 
